<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Models\ConfigStorm;

class CreateConfigStormsTable extends Migration
{
    public function up()
    {
        Schema::create('config_storms', function (Blueprint $table) {
            $table->id();

            $table->text('rest_weekdays')->nullable();

            $table->integer('gold_wastes_order_period')->default(90);

            $table->boolean('is_gold_support_open')->default(false);
	        $table->decimal('gold_support_beans', 10, 2)->default(100);
	        $table->decimal('gold_support_coins', 10, 2)->default(100);
	        $table->decimal('gold_support_cashes', 10, 2)->default(1000);
	        $table->decimal('a_gold_bean_buy_cashes', 10, 2)->default(100);

	        $table->integer('each_upgrade_needs_children')->default(5);
	        $table->decimal('allowed_lowest_transfer_gold_beans', 10, 2)->default(100);
	        $table->decimal('allowed_transfer_gold_beans_multiple', 10, 2)->default(100);
	        $table->decimal('allowed_lowest_transfer_gold_coins', 10, 2)->default(100);

            $table->decimal('round_premium_percent', 10, 2)->default(8.00)->comment('percent of all price');
            $table->decimal('resell_need_beans_percent', 10, 2)->default(3.00)->comment('percent of all price');
            $table->decimal('move_round_profit_percent', 10, 2)->default(4.00)->comment('percent of net price. the round before split');
            $table->decimal('last_round_profit_percent', 10, 2)->default(24.00)->comment('percent of net price. last split round');
            $table->integer('gold_split_resell_period')->default(1);

	        $table->decimal('child_first_record_give_direct_parent_cashes', 10, 2)->default(1000)->comment('child first valid gold_record rewarding direct parent');
            $table->decimal('child_record_give_direct_parent_master_prize_percent', 10, 2)->default(2)->comment('percent of net price');
            $table->decimal('child_record_give_direct_parent_intern_prize_percent', 10, 2)->default(1)->comment('percent of net price');

            $table->decimal('child_record_give_team_parent_masters_prize_percent', 10, 2)->default(1)->comment('percent of net price');
	        $table->integer('child_record_give_team_parent_masters_amount')->default(3)->comment('3 parents will get prize');

	        $table->integer('pay_code_can_try')->default(3);

            $table->boolean('is_overcome_pay_fine')->default(false);
	        $table->integer('pay_gold_record_must_within_minutes')->default(50);
	        $table->integer('take_back_gold_product_within_minutes')->default(10);
	        $table->integer('terminate_gold_product_within_minutes')->default(3);

	        $table->boolean('is_robot_on')->default(true);
	        $table->boolean('is_reclaim_on')->default(true);
	        $table->boolean('is_terminate_on')->default(true);
        });

        ConfigStorm::create(['rest_weekdays' => ["Sat", "Sun"]]);
    }

    public function down()
    {
        Schema::dropIfExists('config_storms');
    }
}
